package com.obtk.service.impl;

import com.obtk.mapper.CustomerMapper2;
import com.obtk.model.Customer;
import com.obtk.service.CustomerService2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 功能说明
 *
 * @author Mr.Sun
 * @date 2023-03-29 15:34:42
 */
@Service
public class CustomerServiceImpl2 implements CustomerService2 {
    @Autowired
    private CustomerMapper2 customerMapper2;
    @Override
    public List<Customer> selectCustomer(Customer customer) {
        return customerMapper2.selectCustomer(customer);
    }

    @Override
    public Customer selectByCustomerName(String custName) {
        return customerMapper2.selectByCustomerName(custName);
    }
    //
    @Override
    public int register(Customer customer) {
        int a = customerMapper2.insert(customer);
        return a;
    }

    @Override
    public Customer selectByCustomerId(Integer custId) {
        return customerMapper2.selectByCustomerId(custId);
    }

    @Override
    public int updateByCustomerId(Customer customer) {
        return customerMapper2.updateByCustomerId(customer);
    }

    @Override
    public int updateStatusBatch(List<String> custIds, Integer custStatus) {
        Map<String,Object> params = new HashMap<String,Object>(2);
        params.put("custIds",custIds);
        params.put("custStatus",custStatus);
        return customerMapper2.updateStatusBatch(params);
    }
}
